//
//  KPFenXiCell.m
//  SelfDriving
//
//  Created by wordtech on 2018/1/17.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "KPFenXiCell.h"
#import "ValidateHelper.h"

@implementation KPFenXiCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.shouyiBgView.layer.cornerRadius = 4;
    self.shouyiBgView.layer.masksToBounds = YES;
    
    self.headImg.layer.cornerRadius = self.headImg.frame.size.width/2;
    self.headImg.layer.masksToBounds = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

   
}

- (void)setModel:(KPAnalyzeModel *)model {

    [self.headImg sd_setImageWithURL:[NSURL URLWithString:model.detail[@"userinfo"][@"headsmall"]]  placeholderImage:[UIImage imageNamed:@"notimgs"]];

    self.nameLabel.text = model.detail[@"userinfo"][@"nickname"];

    self.shouyiLable.text = [NSString stringWithFormat:@"收益:￥%@",model.fee];

    self.timeLabel.text = [ValidateHelper doubleConvertDate: [model.createtime doubleValue] FormatterStr:@"yyyy-MM-dd HH:mm"];

    self.kuaiPaiNameLabel.text = model.detail[@"title"];

    self.watchCountLabel.text = [NSString stringWithFormat:@"%@观看",model.viewperson];

    [self.videoBackImg sd_setImageWithURL:[NSURL URLWithString:model.detail[@"img"]] placeholderImage:[UIImage imageNamed:@"notimgs"]];

    self.bottomOneLabel.text = model.viewcount;

    self.bottomTwoLabel.text = model.zancount;

    self.bottomThreeLabel.text = model.sharecount;
}

- (void)setDtmodel:(DTModel *)Dtmodel {
    [self.headImg sd_setImageWithURL:[NSURL URLWithString:Dtmodel.detail[@"headsmall"]]  placeholderImage:[UIImage imageNamed:@"notimgs"]];
    
    self.nameLabel.text = Dtmodel.detail[@"nickname"];
    
    self.shouyiLable.text = [NSString stringWithFormat:@"收益:￥%@",Dtmodel.fee];
    
    self.timeLabel.text = [ValidateHelper doubleConvertDate: [Dtmodel.createtime doubleValue] FormatterStr:@"yyyy-MM-dd HH:mm"];
    
    self.kuaiPaiNameLabel.text = Dtmodel.detail[@"title"];
    
    self.watchCountLabel.text = [NSString stringWithFormat:@"%@观看",Dtmodel.viewcount];
    
    NSMutableArray * attachmentArr = (NSMutableArray *)Dtmodel.detail[@"attachment"];
    if (attachmentArr.count != 0) {
        [self.videoBackImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",img_Url,Dtmodel.detail[@"attachment"][0][@"path"]]] placeholderImage:[UIImage imageNamed:@"notimgs"]];
    }
    else {
        [self.videoBackImg setImage:[UIImage imageNamed:@"notimgs"]];
    }
    
    
    self.bottomOneLabel.text = Dtmodel.followedcount;
    
    self.bottomTwoLabel.text = Dtmodel.zancount;
    
    self.bottomThreeLabel.text = Dtmodel.forwardcount;
}

@end
